#ifndef VIRTUALDEVICE_H
#define VIRTUALDEVICE_H

#include "virtualdeviceproperty.h"
#include "virtualdevicemethod.h"
#include "virtualdevicemethodresult.h"
#include <string>
#include <map>

namespace xvd
{
    class VirtualDevice
    {
        public:
            VirtualDevice(const std::string& name, const std::string& devicetype, const std::string& version, const std::string& configuration);
            const std::string& Name() const;
            const std::string& DeviceType() const;
            const std::string& Language() const;
            const std::string& Version() const;
            const std::string& Configuration() const;
        protected:
            virtual bool GetPropertyByName(const std::string& propertyName, VirtualDeviceProperty& property);
            virtual bool GetMethodByName(const std::string& methodName, VirtualDeviceMethod& method);
            virtual bool ProcessMethod(VirtualDeviceMethod& method, VirtualDeviceMethodResult& result) = 0;
        private:
            static void LoadConfiguration(VirtualDevice* devicePtr, const std::string& configurationfile);

            std::string m_name;
            std::string m_devicetype;
            std::string m_language;
            std::string m_version;
            std::string m_configuration;
            std::map<std::string, VirtualDeviceProperty> m_properties;
            std::map<std::string, VirtualDeviceMethod> m_methods;
        public:
            static const std::string SERVER;
            void Start();
            void Stop();
    };
}

#endif

